<html>
<head><meta charset="utf-8"><title>pretty-printing comments · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html">pretty-printing comments</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165005357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165005357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165005357">(May 06 2019 at 18:18)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> I am continuing my work on extracting the lexer, and the next major road-block seems to be this little gem:</p>
<p><a href="https://github.com/rust-lang/rust/blob/c3b8ab5199af4a3c11d14b0cbdb17a641e8eee71/src/libsyntax/parse/lexer/comments.rs#L350" target="_blank" title="https://github.com/rust-lang/rust/blob/c3b8ab5199af4a3c11d14b0cbdb17a641e8eee71/src/libsyntax/parse/lexer/comments.rs#L350">https://github.com/rust-lang/rust/blob/c3b8ab5199af4a3c11d14b0cbdb17a641e8eee71/src/libsyntax/parse/lexer/comments.rs#L350</a></p>
<p>My understanding is that this function exists to make pretty-printing of existing rust code more sane, by trying hard to maintain comments and exact form of literals. It is pretty hacky and I wonder if we can somehow refactor it away...</p>
<p>Where exactly do we use pretty printing?  My understanding is that macro expansion goes via pprinting, and it probably doesn't need comments. Perhaps it doesn't need exact forms of literals as well? Is there anything else which needs comments?</p>



<a name="165005465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165005465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165005465">(May 06 2019 at 18:19)</a>:</h4>
<p>As to why this is a roadblock: this function heavily relies on lexer's internal state, which I would like to get rid of. I can hack around it, of course, but I wonder if there's a clender solution, given that this functions smells of technical debt pretty heavily...</p>



<a name="165022663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165022663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165022663">(May 06 2019 at 21:58)</a>:</h4>
<p>Ah, I remember I've seen that thing once when fixing some issues in pretty-printing.</p>



<a name="165022961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165022961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165022961">(May 06 2019 at 22:02)</a>:</h4>
<p>Remaining uses of pretty-printing are<br>
1) print/re-tokenize fallback for proc macros when the tokens are not available directly<br>
2) printing snippets for error reporting, but AFAIK it's usually (and better) done by fetching the snippet from the codemap by span now.<br>
3) literally pretty-printing (<code>--pretty=expanded</code>, etc), and this one looks really bad without comments</p>



<a name="165023123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165023123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165023123">(May 06 2019 at 22:04)</a>:</h4>
<p>Are <code>Literal</code>s collected by <code>gather_comments_and_literals</code> really used?</p>



<a name="165023234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165023234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165023234">(May 06 2019 at 22:06)</a>:</h4>
<p>pprust certainly has logic for pretty-printing literals from AST which is good enough.<br>
So the literal part would be the first candidate for removal.</p>



<a name="165023771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165023771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165023771">(May 06 2019 at 22:15)</a>:</h4>
<p>Also, if we want to pass precise tokens to proc macros (<a href="https://github.com/rust-lang/rust/issues/43081" target="_blank" title="https://github.com/rust-lang/rust/issues/43081">https://github.com/rust-lang/rust/issues/43081</a>) we'll need to keep both the original and escaped versions of literals somehow, and the simplest way is to keep both versions in AST `Lit.</p>



<a name="165023829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165023829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165023829">(May 06 2019 at 22:16)</a>:</h4>
<p>This would mostly fix <a href="https://github.com/rust-lang/rust/issues/60495" target="_blank" title="https://github.com/rust-lang/rust/issues/60495">https://github.com/rust-lang/rust/issues/60495</a> as well (no need to re-escape, since we have the originals).</p>



<a name="165024781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165024781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165024781">(May 06 2019 at 22:30)</a>:</h4>
<p>Yeah, keep the original literals in AST and kill the <code>comments::Literal</code> code and escaping code.</p>



<a name="165024936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165024936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165024936">(May 06 2019 at 22:32)</a>:</h4>
<p>Perhaps I'll do it myself tomorrow, should be easy and fun.</p>



<a name="165024940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165024940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165024940">(May 06 2019 at 22:32)</a>:</h4>
<p>Not sure about comments though.</p>



<a name="165025891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165025891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165025891">(May 06 2019 at 22:49)</a>:</h4>
<p>speaking of pretty-printing comments, if you're refactoring, there's this ancient bug that's related: <a href="https://github.com/rust-lang/rust/issues/6678" target="_blank" title="https://github.com/rust-lang/rust/issues/6678">https://github.com/rust-lang/rust/issues/6678</a></p>



<a name="165066892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165066892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165066892">(May 07 2019 at 12:41)</a>:</h4>
<p>Good, cc @matklad if you get to fixing the literals. I think handing only comments after that would be much simpler. And also don't see an easy and better way to handle comments for <code>--pretty-expanded</code>. Switching wholesale to libsyntax2 is def not easy :-)</p>
<p>Might be a good idea to check how rustfmt handles comments though</p>



<a name="165120506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165120506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165120506">(May 07 2019 at 23:26)</a>:</h4>
<p>Some status update:<br>
I tried to <em>replace</em> "semantic" AST literals (<code>ast::Lit</code>) with their token versions (<code>token::Lit</code>), rather than keep them both together in AST and the result is pretty good so far.<br>
It should be possible to use literals as tokens at least until lowering to HIR with few minor issues:<br>
- A fake AST-only <code>Lit::Bool</code> is needed<br>
- The result of <code>include_bytes!()</code> is not precisely representable as a token (can be non UTF-8), has to be escaped, then unescaped again later during lowering to its semantic form.<br>
- Literals in built-in attributes apparently should to be compared semantically (<code>#[inline = "\x61lways"]</code> == <code>#[inline = "always"]</code>)  (at least for compatibility), and attributes are used through the whole compilation, but are represented as AST. Annoying.</p>



<a name="165120723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165120723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165120723">(May 07 2019 at 23:30)</a>:</h4>
<p>So it may be reasonable to <em>add</em> the token representations to AST first, then optimize by gradually refactoring away all the uses of non-token representation (need to check perf though), I'm going to do that tomorrow or on the holidays.</p>



<a name="165152907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165152907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165152907">(May 08 2019 at 11:05)</a>:</h4>
<blockquote>
<p>It should be possible to use literals as tokens at least until lowering to HIR</p>
</blockquote>
<p>Love this!</p>



<a name="165860595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165860595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165860595">(May 17 2019 at 00:09)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> <br>
So, I tried to address <a href="https://github.com/rust-lang/rust/pull/60679#discussion_r283094395" target="_blank" title="https://github.com/rust-lang/rust/pull/60679#discussion_r283094395">https://github.com/rust-lang/rust/pull/60679#discussion_r283094395</a> (the lack of parse session in attr/mod.rs) and it mostly works (<a href="https://github.com/petrochenkov/rust/commits/apa" target="_blank" title="https://github.com/petrochenkov/rust/commits/apa">https://github.com/petrochenkov/rust/commits/apa</a>).</p>



<a name="165860599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165860599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165860599">(May 17 2019 at 00:09)</a>:</h4>
<p>But at what cost!</p>



<a name="165860788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165860788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165860788">(May 17 2019 at 00:13)</a>:</h4>
<p>You have to pass the session around a lot.<br>
There's a partial remedy though - parse attributes once during lowering to HIR and use only their lowered semantic forms after that.</p>



<a name="165860902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165860902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165860902">(May 17 2019 at 00:15)</a>:</h4>
<p>(Still need to figure out what to do with attributes parsed during rustdoc rendering though, it doesn't have a parse session, perhaps I need to create one.)</p>



<a name="165872356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165872356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165872356">(May 17 2019 at 04:49)</a>:</h4>
<p>Cool! I wonder if we really need to pass in the whole ParseSession?<br>
Shouldn’t just diagnosis handler be enough? The parser API currently<br>
requires the session, but if previous API worked only with handler, perhaps<br>
the Parser API for attrs could be tweaked?</p>



<a name="165884284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165884284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165884284">(May 17 2019 at 09:11)</a>:</h4>
<p>I wanted to eliminate <code>(Attribute/MetaItem/NestedMetaItem)::from_tokens</code> which duplicate equivalent parser methods.</p>



<a name="165884366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165884366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165884366">(May 17 2019 at 09:12)</a>:</h4>
<p>Duplicate equivalent parser methods, but without access to anything - no parser, no parse session, no diagnostic handler.</p>



<a name="165884503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165884503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165884503">(May 17 2019 at 09:15)</a>:</h4>
<p>To use the equivalent parser methods we need a <code>Parser</code> which we create using the passed <code>ParseSession</code>.</p>



<a name="165884595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165884595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165884595">(May 17 2019 at 09:16)</a>:</h4>
<p>We can create a fresh <code>ParseSession</code> for each attribute as well instead of passing the existing one, but that would be more expensive (need to measure).</p>



<a name="165884922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165884922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165884922">(May 17 2019 at 09:22)</a>:</h4>
<p>To resolve the original issue (no diagnostic handler to pass to <code>Lit::from_token</code>), we can indeed pass the handler only (no more convenient than passing parse session) or create a fresh handler, but that wouldn't allow to get rid of the duplicate parsing code in <code>...::from_tokens</code>.</p>



<a name="165897527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165897527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165897527">(May 17 2019 at 12:52)</a>:</h4>
<p>Yeah, but I wonder does the code inside <code>Parser</code> that handle attributes really needs<code>ParseSession</code>? </p>
<p>That is, can we:</p>
<ul>
<li>refactor <code>Parser</code>'s methods for attributes to not require anything besides the Handler</li>
<li>make handler in attrs/mod mandatory</li>
<li>deduplicate code in parser and attrs/mod</li>
</ul>
<p>I don't really understand all of the dependencies here, so this might not work for some good reasons</p>



<a name="165897563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165897563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165897563">(May 17 2019 at 12:53)</a>:</h4>
<p>In other words, can we make both<code>Parser</code> and <code>attrs/mod.rs</code> to just call into separate meta-item parsing routins, which require only a subset of parser's functionality?</p>



<a name="165907744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165907744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165907744">(May 17 2019 at 15:07)</a>:</h4>
<p>Attributes include paths, and path grammar, in its turn, includes <em>everything</em> in generic arguments.</p>



<a name="165908154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165908154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165908154">(May 17 2019 at 15:12)</a>:</h4>
<p>And new <code>parse_attr_path</code> ignoring generics in addition to the normal <code>parse_path</code> would look pretty similar to <code>Attribute::from_tokens</code>.</p>



<a name="165908233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165908233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165908233">(May 17 2019 at 15:13)</a>:</h4>
<p>As I understand it, making the handler mandatory in attrs/mod is not easier than making parse session available, so we can go for latter basically.</p>



<a name="165908516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165908516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165908516">(May 17 2019 at 15:16)</a>:</h4>
<p>(I didn't yet figure out what happens if you create a fresh diagnostics handler and use it instead of the primary one in <code>session.parse_sess.diagnostic_handler</code>.)</p>



<a name="165967196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/pretty-printing%20comments/near/165967196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/pretty-printing.20comments.html#165967196">(May 18 2019 at 09:30)</a>:</h4>
<blockquote>
<p>Attributes include paths, and path grammar, in its turn, includes everything in generic arguments.</p>
</blockquote>
<p>aha, that makes sense!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>